package com.study.feign;

import com.study.common.TableId;
import com.study.goods.DeductGoodsInventory;
import com.study.goods.SimpleGoodsInfo;
import com.study.vo.CommonResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

/**
 * 不安全的商品服务 feign接口
 */
@FeignClient(
    contextId = "NotSecureGoodsClient",
    value = "ecommerce-goods-service"
)
public interface NotSecureGoodsClient {

    //扣减商品库存
    @RequestMapping(
            value = "ecommerce-goods-service/goods/deduct-goods-inventory",
            method = RequestMethod.POST
    )
    CommonResponse<Boolean> deductGoodsInventory(@RequestBody List<DeductGoodsInventory> deductGoodsInventories);

    //简单商品信息
    @RequestMapping(
            value = "ecommerce-goods-service/goods/simple-goods-info",
            method = RequestMethod.POST
    )
    CommonResponse<List<SimpleGoodsInfo>> getSimpleGoodsInfoByTableId(@RequestBody TableId tableId);
}
